package codelib.spring3hibernate3.biz;

import java.util.List;

import javax.annotation.Resource;
import org.springframework.stereotype.Component;

import codelib.spring3hibernate3.dao.StudentDAO;
import codelib.spring3hibernate3.dao.model.Student;

@Component("StudentService")
public class StudentService {
	private StudentDAO studentDAO;
	
	public void create(Student student){
		this.studentDAO.create(student);
	}
	
	public void update(Student student){
		this.studentDAO.update(student);
	}
	
	public void delete(int studentId){
		this.studentDAO.delete(studentId);
	}

	public List<Student> retrieve(){
		return this.studentDAO.retrieve();
	}
	
	public List<Student> retrieveByName(String name){
		return this.studentDAO.retrieveByName(name);
	}
	
	//getter and setter
	public StudentDAO getStudentDAO() {
		return studentDAO;
	}
	
	@Resource(name="StudentDAOImpl")
	public void setStudentDAO(StudentDAO studentDAO) {
		this.studentDAO = studentDAO;
	}

}
